import { SingleInstance } from './singleinstance';

async function run (){

    const driver = SingleInstance.create_driver();
    await driver.get('http://39.107.96.138:3000/signin');

    const username = await driver.findElement({css:'#name'})
    await username.sendKeys('testuser1');
    const password = await driver.findElement({css:'#pass'})
    await password.sendKeys('123456');

    const submit = await driver.findElement({css:'[type="submit"]'});
    await submit.click();

    await driver.get('http://39.107.96.138:3000/user/testuser1');

    const ele = await driver.findElement({css:'a[class="topic_title"]'});
    await ele.click();

    const del = await driver.findElement({css:'[title="删除"]'});
    await del.click();

    // 
    const alert= await driver.switchTo().alert();
    console.log(await alert.getText());
    await alert.accept();

}

run();